home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / libg++ / libiberty / Makefile.in < prev    next >
Makefile  |  1994-02-15  |  8KB  |  250 lines

  1. #
  2. # Makefile
  3. #   Copyright (C) 1990, 1991, 1992 Free Software Foundation
  4. #
  5. # This file is part of the libiberty library.
  6. # Libiberty is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2 of the License, or (at your option) any later version.
  10. #
  11. # Libiberty is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with libiberty; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  19. # Cambridge, MA 02139, USA.
  20. #
  21.  
  22. # This file was written, and is maintained by K. Richard Pixley
  23. # <rich@cygnus.com>.
  24.  
  25. #
  26. # Makefile for libiberty directory
  27. #
  28.  
  29. srcdir = .
  30.  
  31. #prefix = /usr/local
  32. prefix = /NextDeveloper/Headers
  33.  
  34. exec_prefix = $(prefix)
  35. bindir = $(exec_prefix)/bin
  36. libdir = $(exec_prefix)/lib
  37.  
  38. datadir = $(prefix)/lib
  39.  
  40. mandir = $(prefix)/man
  41. man1dir = $(mandir)/man1
  42. man2dir = $(mandir)/man2
  43. man3dir = $(mandir)/man3
  44. man4dir = $(mandir)/man4
  45. man5dir = $(mandir)/man5
  46. man6dir = $(mandir)/man6
  47. man7dir = $(mandir)/man7
  48. man8dir = $(mandir)/man8
  49. man9dir = $(mandir)/man9
  50. infodir = $(prefix)/info
  51. includedir = $(prefix)/include
  52. oldincludedir =
  53. docdir = $(datadir)/doc
  54.  
  55. SHELL = /bin/sh
  56.  
  57. INSTALL = install -c
  58. INSTALL_PROGRAM = $(INSTALL)
  59. INSTALL_DATA = $(INSTALL)
  60.  
  61. AR = ar
  62. AR_FLAGS = rc
  63.  
  64. CFLAGS = -g
  65. BISON = bison
  66. MAKEINFO = makeinfo
  67. RANLIB = ranlib
  68.  
  69. MAKEOVERRIDES =
  70.  
  71. XTRAFLAGS =
  72.  
  73. TARGETLIB = libiberty.a
  74.  
  75. CONFIG_H = lconfig.h
  76. NEEDED_LIST = lneeded-list
  77.  
  78. # HOST_OFILES contains the list of objects that should be in the
  79. # library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
  80. # A configuration may override this with a fixed list a object files
  81. # names (hard to maintain), or some other way to generate a list.
  82. HOST_OFILES=`cat needed-list`
  83.  
  84. # Extra targets that the top-level target depends on.
  85. # Specifically, what needs to be made before HOST_OFILES can be used.
  86. # Can be empty if HOST_OFILES is just a list of file names.
  87. DO_ALSO = needed-list
  88.  
  89. # A configuration can specify extra .o files that should be included,
  90. # even if they are in libc. (Perhaps the libc version is buggy.)
  91. EXTRA_OFILES = 
  92.  
  93. all:    $(TARGETLIB)
  94. .PHONY: check installcheck
  95. check installcheck:
  96.  
  97.  
  98. #### Host, target, and site specific Makefile fragments come in here.
  99. ###
  100.  
  101. .c.o:
  102.     $(CC) -c $(CFLAGS) -I. -I$(srcdir)/../include $(HDEFINES) $(XTRAFLAGS) $<
  103.  
  104. # The default target just invokes make recursively.
  105. # However, the automatic configuration (in config/mh_default).
  106. # first causes it to figure out the objects missing in libc.
  107. info install-info clean-info dvi:
  108.  
  109. # NOTE: If you add new files to the library, add them to this list
  110. # (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
  111. CFILES = alloca.c argv.c basename.c bcmp.c bcopy.c bzero.c concat.c \
  112.      cplus-dem.c fdmatch.c getcwd.c getopt.c getopt1.c getpagesize.c \
  113.          ieee-float.c index.c insque.c \
  114.      memchr.c memcmp.c memcpy.c memmove.c memset.c \
  115.          obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \
  116.      strcasecmp.c strncasecmp.c \
  117.          strchr.c strdup.c strerror.c strrchr.c strsignal.c \
  118.          strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
  119.      vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c xmalloc.c
  120. # These are always included in the library.
  121. REQUIRED_OFILES = argv.o basename.o concat.o cplus-dem.o fdmatch.o \
  122.   getopt.o getopt1.o ieee-float.o obstack.o spaces.o strerror.o strsignal.o \
  123.   xmalloc.o 
  124.  
  125. # Do we want/need any config overrides?
  126. #     
  127.  
  128. STAGESTUFF = $(TARGETLIB) *.o
  129.  
  130. INSTALL_DEST = libdir
  131. install: install_to_$(INSTALL_DEST)
  132.  
  133. install_to_libdir: all
  134.     $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
  135.     ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
  136.     mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  137.  
  138. install_to_tooldir: all
  139.     $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n
  140.     ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n )
  141.     mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib/$(TARGETLIB)
  142.  
  143. # The default configuration adds to libiberty all those functions that are
  144. # missing in libc.  More precisely, it includes whatever $(CC) fails to find.
  145. # Then a sed+awk combination translates the ld error messages into
  146. # a list of .o files.
  147.  
  148. needed-list: $(NEEDED_LIST)
  149.     cp $(NEEDED_LIST) needed-list
  150.  
  151. lneeded-list: $(EXTRA_OFILES) needed.awk errors
  152.     rm -f lneeded-list
  153.     f=""; \
  154.     for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
  155.       case " $$f " in \
  156.         *" $$i "*) ;; \
  157.         *) f="$$f $$i" ;; \
  158.       esac ; \
  159.     done ; \
  160.     echo $$f >>lneeded-list
  161.  
  162. # Generate an awk script that looks for functions in functions.def
  163.  
  164. needed.awk: $(srcdir)/functions.def Makefile
  165.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  166.       "- DO NOT EDIT!" >needed.awk
  167.     grep '^DEF(' < $(srcdir)/functions.def \
  168.         | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
  169.         >>needed.awk
  170.  
  171. config.h: $(CONFIG_H)
  172.     cp $(CONFIG_H) config.h
  173.  
  174. lconfig.h: needed2.awk errors
  175.     echo "/* !Automatically generated from $(srcdir)/functions.def"\
  176.       "- DO NOT EDIT! */" >lconfig.h
  177.     awk -f needed2.awk <errors >>lconfig.h
  178.  
  179. # Generate an awk script that looks for variables in functions.def
  180.  
  181. needed2.awk: $(srcdir)/functions.def Makefile
  182.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  183.       "- DO NOT EDIT!" >needed2.awk
  184.     grep '^DEFVAR(' < $(srcdir)/functions.def \
  185.      | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  186.      >>needed2.awk
  187.     grep '^DEFFUNC(' < $(srcdir)/functions.def \
  188.      | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  189.      >>needed2.awk
  190.  
  191. dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
  192.     $(CC) -c $(CFLAGS) -I. -I$(srcdir)/../include $(HDEFINES) $(XTRAFLAGS) $(srcdir)/dummy.c 2>/dev/null
  193.  
  194. errors: dummy.o $(EXTRA_OFILES)
  195.     -($(CC) -o dummy $(LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
  196.  
  197. $(HOST_OFILES) $(REQUIRED_OFILES) : config.h
  198.  
  199. RULE1 = $(TARGETLIB)
  200. $(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
  201.     @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) \
  202.          HOST_OFILES="$(HOST_OFILES)" \
  203.         "CC=$(CC)" "CFLAGS=$(CFLAGS)" \
  204.         "AR=$(AR)" "AR_FLAGS=$(AR_FLAGS)" "RANLIB=$(RANLIB)" \
  205.         "XTRAFLAGS=$(XTRAFLAGS)" "SHELL=$(SHELL)"
  206.  
  207. # Rule invoked by recursive make in $(RULE1).
  208. RULE2 = not-used
  209. $(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
  210.     rm -rf $(TARGETLIB)
  211.     $(AR) $(AR_FLAGS) $(TARGETLIB) \
  212.       $(REQUIRED_OFILES) $(HOST_OFILES)
  213.     $(RANLIB) $(TARGETLIB)
  214.  
  215. .always.:
  216. # Do nothing.
  217.  
  218. .PHONEY: all etags tags ls clean stage1 stage2 .always.
  219.  
  220. etags tags: TAGS
  221.  
  222. TAGS: $(CFILES) $(HFILES)
  223.     etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
  224.  
  225. # The standalone demangler (c++filt) has been moved to binutils.
  226. demangle:
  227.     @echo "The standalone demangler, now named c++filt, is now"
  228.     @echo "a part of binutils."
  229.     @false
  230.  
  231. ls:
  232.     @echo Makefile $(HFILES) $(CFILES)
  233.  
  234. # Need to deal with profiled libraries, too.
  235.  
  236. mostlyclean:
  237.     rm -f *.o core errs \#* *.E a.out
  238.     rm -f needed.awk needed2.awk errors dummy needed-list config.h
  239.     rm -f $(CONFIG_H) $(NEEDED_LIST)
  240. clean: mostlyclean
  241.     rm -f *.a
  242. distclean: clean
  243.     rm -f *~ Makefile config.status alloca-conf.h TAGS
  244. realclean: distclean
  245.  
  246. force:
  247.  
  248. Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
  249.     $(SHELL) ./config.status
  250.